import config from './index.config';
import run from './index.run';
import core from './core';
import components from './components';
import routes from './index.routes';
import api from './api';
import pages from './pages';

/* global angular */
const App = angular.module(
  'pa', [
    // plugins
    'ui.router',
    'ngAnimate',
    'ngCookies',
    'ngTouch',
    'ngSanitize',
    'ngMessages',
    'ngAria',
    'ngResource',
    'oc.lazyLoad',
    'ng-bootstrap-datepicker',
    'ngDialog',
    'ui.bootstrap.module.pagination',
    'ui.bootstrap.module.dropdown',
    // 'ui.uploader',

    // core
    core.name,

    // components
    components.name,

    // api service
    api.name,

    // routes
    routes.name,

    // pages
    pages.name,

  ],
);

// app config must run before mock config
App.config(config);

if (process.mock) {
  const Mock = require('./mock').default;
  Mock.mockjax(App);
}


App.run(run);

export default App;
